#ifndef KLINEDATAFETCHER_H
#define KLINEDATAFETCHER_H

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include "klinedata.h"

class KLineDataFetcher : public QObject
{
    Q_OBJECT
public:
    explicit KLineDataFetcher(QObject *parent = nullptr);
    void fetchKLineData(const QString &token, const QString &code, const QString &klineType);
    QVector<KLineData> loadKLineDataFromFile(const QString &filePath); // 新增方法

signals:
    void kLineDataFetched(const QVector<KLineData> &data);
    void fetchFailed(const QString &error);

private slots:
    void onReplyFinished(QNetworkReply *reply);

private:
    QNetworkAccessManager *networkManager;
};

#endif // KLINEDATAFETCHER_H
